package entity;

import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "Case")
@Entity
@Table(name="t_case")
public class Case extends AbstractEntity {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="case_id")
	private Long id;
	
	@Column(name="case_name", length=100)
	private String name;

	
	@Column(name = "catalog_id")
	private Long catalogId;	
	
	
	@Column(name="profilegroup_id")
	private Long profilegroupId;

	@Transient
	private Collection<Step> steps;

	@XmlElement(name = "subcases")
	@Transient
	private Collection<Subcase> subcases;
	
	@Transient
	private Collection<Result> results;
	

	@Override
	public Long getKey() {
		return id;
	}
	
	@Override
	public void acceptValue(AbstractEntity input) {
		if(input!=null && input instanceof Case){
			Case Case1=(Case)input;
			this.setName(Case1.getName());
			this.setCatalogId(Case1.getCatalogId());
			this.setProfilegroupId(Case1.getProfilegroupId());
		}
		
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getCatalogId() {
		return catalogId;
	}

	public void setCatalogId(Long catalogId) {
		this.catalogId = catalogId;
	}

	public Collection<Step> getSteps() {
		return steps;
	}

	public void setSteps(Collection<Step> steps) {
		this.steps = steps;
	}

	public Collection<Subcase> getSubCases() {
		return subcases;
	}

	public void setSubCases(Collection<Subcase> subCases) {
		this.subcases = subCases;
	}

	public Collection<Result> getResults() {
		return results;
	}

	public void setResults(Collection<Result> results) {
		this.results = results;
	}

	public Long getProfilegroupId() {
		return profilegroupId;
	}

	public void setProfilegroupId(Long profilegroupId) {
		this.profilegroupId = profilegroupId;
	}



}
